#include "fullPermutation.h"
//string str;
//string tmp;
//vector<bool> vis;
fullPermutation::fullPermutation(int n)
{
   vis.resize(n);
}

void fullPermutation::dfs(int cnt, int n, string str)
{
    if(cnt == n)
    {
        cout << tmp << endl;
        return;
    }
    for (int i=0; i<n; i++) {
        if(vis[i] == false)
        {
            tmp.push_back(str[i]);
            vis[i]=true;
            dfs(cnt+1,n,str);
            vis[i]=false;
            tmp.pop_back();
        }

    }
}

void testRunFullPermBT()
{
    string str;
    getline(cin,str);
    sort(str.begin(),str.end());
    int n = str.size();
    fullPermutation * fp = new fullPermutation(n);
    fp->dfs(0,n,str);
    delete fp;
}
